export default (stamp,type) => {
    let time = new Date(stamp*1000);
    // if(stamp.length == 10) time = new Date(stamp*1000);
    let y = time.getFullYear();
    let m = time.getMonth()+1;
    if(m < 10) {
        m = '0' + m;
    }
    let d = time.getDate();
    if(d < 10) {
        d = '0' + d;
    }
    let h = time.getHours();
    if(h < 10) {
        h = '0' + h;
    }
    let min = time.getMinutes();
    if(min < 10) {
        min = '0' + min;
    }
    let s = time.getSeconds();
    if(s < 10) {
        s = '0' + s;
    }
    let chang_time = ""
    switch(type) {
        case "YY":
            chang_time = y;
        break;
        case "DD":
            chang_time = d;
        break;
        case "YY-MM":
            chang_time = y + '-' + m;
        break;
        case "YY-MM-DD":
            chang_time = y + '-' + m + '-' + d;
        break;
        case "hh:mm:ss":
            chang_time = h + ':' + min + ':'+ s;
        break;
        case "MM-DD hh:mm":
            chang_time = m + '-' + d +' '+ h + ':' + min;
        break;
        case "hh:mm":
            chang_time = h + ':' + min;
        break;
        default:
            chang_time = y + '-' + m + '-' + d +' '+ h + ':' + min + ':'+ s;
    }
    
    return chang_time
}